package com.imooc.order.controller;

import com.imooc.order.message.StreamClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @Name com.imooc.order.controller.SendMessageController
 * @Description
 * @Author Elwyn
 * @Version 2020/3/19
 * @Copyright 上海云辰信息科技有限公司
 **/
@RestController
public class SendMessageController {
	@Autowired
	private StreamClient streamClient;

	@GetMapping("/sendMessage")
	public void process() {
		streamClient.output().send(MessageBuilder.withPayload("now " + new Date()).build());
	}
}
